package com.asuka.task;

import com.asuka.websocket.WebSocketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
public class WebSocketTask {

    @Autowired
    private WebSocketService webSocketService;


   //@Scheduled(cron = "0/5 * * * * ?")
    public void autoWebSocket(){
        System.out.println("发送消息");
        webSocketService.sendToAllClient("Asuka"+ LocalDateTime.now());
    }



}
